<?php
// 本文档自动生成，仅供测试运行
import("@.Public.UserCheck");//验证用户是否登录类
class IndexAction extends Action
{
    /**
    +----------------------------------------------------------
    * 默认操作
    +----------------------------------------------------------
    */
	
    public function index()
    {
    	$usercheck=new UserCheck();
		$this->assign('root',__ROOT__);
		$this->assign('app',__APP__);
		$this->assign('url',__URL__);
		$this->assign('commonpath',COMMON_PATH);

		if($usercheck->isLogin())
    	{
    		$this->assign('upload',"<a href='__APP__/upload'>上传</a>		");
    		$this->assign('logout',"<a href='__APP__/UserManage/logout'>登出</a>		");
    		$this->assign('usercenter',"<a href='__APP__/usercenter'>用户中心</a>		");
    	}
    	else 
    	{
    		$this->assign('login',"<a href='__APP__/UserManage/login'>登录</a> 	");
    		$this->assign('register',"<a href='__APP__/UserManage/register'>注册</a>		");
    	}
    	$result=$this->queryVideo();
		$this->videolist = $result['list'];
		$this->page=$result['page'];
    	$this->display();
    }
    public function queryVideo()
    {
    	$uservideo=M('User_video');
    	import("ORG.Util.Page");
    	$count=$uservideo->count();
    	$Page=new Page($count,3);
    	$show=$Page->show();
    	$list=$uservideo->limit($Page->firstRow.','.$Page->listRows)->select();
    	$result=array('list'=>$list,'page'=>$show);
    	return $result;
    }


    /**
    +----------------------------------------------------------
    * 探针模式
    +----------------------------------------------------------
    */
    public function checkEnv()
    {
        load('pointer',THINK_PATH.'/Tpl/Autoindex');//载入探针函数
        $env_table = check_env();//根据当前函数获取当前环境
        echo $env_table;
    }

}
?>